package com.xnx3.banmahuishou.core.util;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.xnx3.banmahuishou.core.entity.Area;
import com.xnx3.j2ee.pluginManage.interfaces.DatabaseLoadFinishInterface;
import com.xnx3.j2ee.util.SpringUtil;

/**
 * 获取行政区划代码字典
 */
public class AreaUtil implements DatabaseLoadFinishInterface{
	public static Map<Integer, Area> areaMap;
	static {
		areaMap = new HashMap<Integer, Area>();
	}
	@Override
	public void databaseLoadFinish() {
		if (areaMap.size() < 1) {
			System.err.println("areaMap是空....");
			List<Area> list = SpringUtil.getSqlService().findAll(Area.class);
			for (Area area : list) {
				areaMap.put(area.getId(), area);
			}
		}
	}
	
}